package jcommon.chap1_j2seplus.array;

import java.util.Map;

import org.apache.commons.lang.ArrayUtils;

public class CreateMap {

	public static void main(String[] args) {
		Object[] weightArray = new Object[][] { { "H", new Double(1.007) },
				{ "He", new Integer(4) }, { "Li", new Double(6.941) },
				{ "Be", new Double(9.012) }, { "B", new Double(10.811) },
				{ "C", new Double(12.010) }, { "N", new Double(14.007) },
				{ "O", new Double(15.999) }, { "F", new Double(18.998) },
				{ "Ne", new Double(20.180) } };
		
		// Create a Map mapping colors.
		Map weights = ArrayUtils.toMap( weightArray );
		Double hydrogenWeight = (Double)weights.get( "H" );
		System.out.println(hydrogenWeight);
	}
}
